<?php
/**
 * memcache类封装
 * @author: ChunYang.Jiang<chunyang@staff.sina.com.cn>
 * @date: 2011-05-03 
 * @copyright: sina
 * @version $Id$
 */
class Mem
{
	public static $mc;

	private function __construct()
	{
		;
	}
	
	private static function init () {
		if (empty(self::$mc)) {
			self::$mc = memcache_init();
			if (self::$mc == false) {
				Util::log('Memcache Server Init Fail!');
			}
		}
	}

	public static function set ($key, $value, $time = 6000) {
		self::init();
		return memcache_set(self::$mc, $key, $value, 0, $time);
	}

	public static function get ($key) {
		self::init();
		return memcache_get(self::$mc, $key);
	}

	public static function delete ($key) {
		self::init();
		return memcache_delete(self::$mc, $key);
	}
}
